
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Event Versioning · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="event-serialization.html" />
    
    
    <link rel="prev" href="event-bus-and-event-store.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../architecture-overview/">
            
                <a href="../../architecture-overview/">
            
                    
                    Architecture Overview
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../architecture-overview/ddd-cqrs-concepts.html">
            
                <a href="../../architecture-overview/ddd-cqrs-concepts.html">
            
                    
                    DDD & CQRS Concepts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../architecture-overview/event-sourcing.html">
            
                <a href="../../architecture-overview/event-sourcing.html">
            
                    
                    Event Sourcing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../architecture-overview/event-driven-microservices.html">
            
                <a href="../../architecture-overview/event-driven-microservices.html">
            
                    
                    Event-Driven Microservices
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../axon-server-introduction.html">
            
                <a href="../../axon-server-introduction.html">
            
                    
                    Axon Server
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../release-notes/">
            
                <a href="../../release-notes/">
            
                    
                    Release Notes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../release-notes/rn-axon-framework/">
            
                <a href="../../release-notes/rn-axon-framework/">
            
                    
                    Axon Framework
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../../release-notes/rn-axon-framework/rn-af-major-releases.html">
            
                <a href="../../release-notes/rn-axon-framework/rn-af-major-releases.html">
            
                    
                    Major Releases
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../../release-notes/rn-axon-framework/rn-af-minor-releases.html">
            
                <a href="../../release-notes/rn-axon-framework/rn-af-minor-releases.html">
            
                    
                    Minor Releases
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../release-notes/rn-axon-server/">
            
                <a href="../../release-notes/rn-axon-server/">
            
                    
                    Axon Server
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../../release-notes/rn-axon-server/rn-as-major-releases.html">
            
                <a href="../../release-notes/rn-axon-server/rn-as-major-releases.html">
            
                    
                    Major Releases
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.2" data-path="../../release-notes/rn-axon-server/rn-asse-minor-releases.html">
            
                <a href="../../release-notes/rn-axon-server/rn-asse-minor-releases.html">
            
                    
                    Minor Releases Standard Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.3" data-path="../../release-notes/rn-axon-server/rn-as-minor-releases.html">
            
                <a href="../../release-notes/rn-axon-server/rn-as-minor-releases.html">
            
                    
                    Minor Releases Enterprise Edition
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../release-notes/axon-framework-extensions.html">
            
                <a href="../../release-notes/axon-framework-extensions.html">
            
                    
                    Axon Framework Extensions
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Getting Started</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../../getting-started/quick-start.html">
            
                <a href="../../getting-started/quick-start.html">
            
                    
                    Quick Start
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Axon Framework</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../introduction.html">
            
                <a href="../introduction.html">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../messaging-concepts/">
            
                <a href="../messaging-concepts/">
            
                    
                    Messaging Concepts
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="../messaging-concepts/anatomy-message.html">
            
                <a href="../messaging-concepts/anatomy-message.html">
            
                    
                    Anatomy of a Message
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="../messaging-concepts/message-correlation.html">
            
                <a href="../messaging-concepts/message-correlation.html">
            
                    
                    Message Correlation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3" data-path="../messaging-concepts/message-intercepting.html">
            
                <a href="../messaging-concepts/message-intercepting.html">
            
                    
                    Message Intercepting
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.4" data-path="../messaging-concepts/supported-parameters-annotated-handlers.html">
            
                <a href="../messaging-concepts/supported-parameters-annotated-handlers.html">
            
                    
                    Supported Parameters for Annotated Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.5" data-path="../messaging-concepts/exception-handling.html">
            
                <a href="../messaging-concepts/exception-handling.html">
            
                    
                    Exception Handling
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.6" data-path="../messaging-concepts/unit-of-work.html">
            
                <a href="../messaging-concepts/unit-of-work.html">
            
                    
                    Unit of Work
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../axon-framework-commands/">
            
                <a href="../axon-framework-commands/">
            
                    
                    Commands
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="../axon-framework-commands/modeling/">
            
                <a href="../axon-framework-commands/modeling/">
            
                    
                    Modeling
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1.1" data-path="../axon-framework-commands/modeling/aggregate.html">
            
                <a href="../axon-framework-commands/modeling/aggregate.html">
            
                    
                    Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.2" data-path="../axon-framework-commands/modeling/multi-entity-aggregates.html">
            
                <a href="../axon-framework-commands/modeling/multi-entity-aggregates.html">
            
                    
                    Multi-Entity Aggregates
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.3" data-path="../axon-framework-commands/modeling/state-stored-aggregates.html">
            
                <a href="../axon-framework-commands/modeling/state-stored-aggregates.html">
            
                    
                    State Stored Aggregates
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.4" data-path="../axon-framework-commands/modeling/aggregate-creation-from-another-aggregate.html">
            
                <a href="../axon-framework-commands/modeling/aggregate-creation-from-another-aggregate.html">
            
                    
                    Aggregate Creation from another Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.5" data-path="../axon-framework-commands/modeling/aggregate-polymorphism.html">
            
                <a href="../axon-framework-commands/modeling/aggregate-polymorphism.html">
            
                    
                    Aggregate Polymorphism
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.6" data-path="../axon-framework-commands/modeling/conflict-resolution.html">
            
                <a href="../axon-framework-commands/modeling/conflict-resolution.html">
            
                    
                    Conflict Resolution
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="../axon-framework-commands/command-dispatchers.html">
            
                <a href="../axon-framework-commands/command-dispatchers.html">
            
                    
                    Command Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.3" data-path="../axon-framework-commands/command-handlers.html">
            
                <a href="../axon-framework-commands/command-handlers.html">
            
                    
                    Command Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.4" data-path="../axon-framework-commands/infrastructure.html">
            
                <a href="../axon-framework-commands/infrastructure.html">
            
                    
                    Infrastructure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.5" data-path="../axon-framework-commands/configuration.html">
            
                <a href="../axon-framework-commands/configuration.html">
            
                    
                    Configuration
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="./">
            
                <a href="./">
            
                    
                    Events
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.1" data-path="event-dispatchers.html">
            
                <a href="event-dispatchers.html">
            
                    
                    Event Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2" data-path="event-handlers.html">
            
                <a href="event-handlers.html">
            
                    
                    Event Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.3" data-path="event-processors/">
            
                <a href="event-processors/">
            
                    
                    Event Processors
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.3.1" data-path="event-processors/subscribing.html">
            
                <a href="event-processors/subscribing.html">
            
                    
                    Subscribing Event Processors
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.3.2" data-path="event-processors/streaming.html">
            
                <a href="event-processors/streaming.html">
            
                    
                    Streaming Event Processors
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4.4" data-path="event-bus-and-event-store.html">
            
                <a href="event-bus-and-event-store.html">
            
                    
                    Event Bus & Event Store
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="3.4.5" data-path="event-versioning.html">
            
                <a href="event-versioning.html">
            
                    
                    Event Versioning
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.6" data-path="event-serialization.html">
            
                <a href="event-serialization.html">
            
                    
                    Event Serialization
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../queries/">
            
                <a href="../queries/">
            
                    
                    Queries
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="../queries/query-processing.html">
            
                <a href="../queries/query-processing.html">
            
                    
                    Query Processing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2" data-path="../queries/query-dispatchers.html">
            
                <a href="../queries/query-dispatchers.html">
            
                    
                    Query Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.3" data-path="../queries/query-handlers.html">
            
                <a href="../queries/query-handlers.html">
            
                    
                    Query Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.4" data-path="../queries/implementations.html">
            
                <a href="../queries/implementations.html">
            
                    
                    Implementations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.5" data-path="../queries/configuration.html">
            
                <a href="../queries/configuration.html">
            
                    
                    Configuration
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../sagas/">
            
                <a href="../sagas/">
            
                    
                    Sagas
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.6.1" data-path="../sagas/implementation.html">
            
                <a href="../sagas/implementation.html">
            
                    
                    Implementation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.2" data-path="../sagas/associations.html">
            
                <a href="../sagas/associations.html">
            
                    
                    Associations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.3" data-path="../sagas/infrastructure.html">
            
                <a href="../sagas/infrastructure.html">
            
                    
                    Infrastructure
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../deadlines/">
            
                <a href="../deadlines/">
            
                    
                    Deadlines
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.1" data-path="../deadlines/deadline-managers.html">
            
                <a href="../deadlines/deadline-managers.html">
            
                    
                    Deadline Managers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.2" data-path="../deadlines/event-schedulers.html">
            
                <a href="../deadlines/event-schedulers.html">
            
                    
                    Event Schedulers
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="../testing/">
            
                <a href="../testing/">
            
                    
                    Testing
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.8.1" data-path="../testing/commands-events.html">
            
                <a href="../testing/commands-events.html">
            
                    
                    Commands / Events
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8.2" data-path="../testing/sagas-1.html">
            
                <a href="../testing/sagas-1.html">
            
                    
                    Sagas
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="../tuning/">
            
                <a href="../tuning/">
            
                    
                    Tuning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.9.1" data-path="../tuning/event-snapshots.html">
            
                <a href="../tuning/event-snapshots.html">
            
                    
                    Event Snapshots
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.2" data-path="../tuning/event-processing.html">
            
                <a href="../tuning/event-processing.html">
            
                    
                    Event Processing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.3" data-path="../tuning/command-processing.html">
            
                <a href="../tuning/command-processing.html">
            
                    
                    Command Processing
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="../monitoring-and-metrics.html">
            
                <a href="../monitoring-and-metrics.html">
            
                    
                    Monitoring and Metrics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="../spring-boot-integration.html">
            
                <a href="../spring-boot-integration.html">
            
                    
                    Spring Boot Integration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="../modules.html">
            
                <a href="../modules.html">
            
                    
                    Modules
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Axon Server</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../../axon-server/introduction.html">
            
                <a href="../../axon-server/introduction.html">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../../axon-server/installation/">
            
                <a href="../../axon-server/installation/">
            
                    
                    Installation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1" data-path="../../axon-server/installation/local-installation/">
            
                <a href="../../axon-server/installation/local-installation/">
            
                    
                    Local Installation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1.1" data-path="../../axon-server/installation/local-installation/axon-server-se.html">
            
                <a href="../../axon-server/installation/local-installation/axon-server-se.html">
            
                    
                    Axon Server SE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.1.2" data-path="../../axon-server/installation/local-installation/axon-server-ee.html">
            
                <a href="../../axon-server/installation/local-installation/axon-server-ee.html">
            
                    
                    Axon Server EE
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2.2" data-path="../../axon-server/installation/docker-k8s/">
            
                <a href="../../axon-server/installation/docker-k8s/">
            
                    
                    Docker / K8s
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.2.1" data-path="../../axon-server/installation/docker-k8s/axon-server-se.html">
            
                <a href="../../axon-server/installation/docker-k8s/axon-server-se.html">
            
                    
                    Axon Server SE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.2.2" data-path="../../axon-server/installation/docker-k8s/axon-server-ee.html">
            
                <a href="../../axon-server/installation/docker-k8s/axon-server-ee.html">
            
                    
                    Axon Server EE
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../../axon-server/administration/">
            
                <a href="../../axon-server/administration/">
            
                    
                    Administration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1" data-path="../../axon-server/administration/admin-configuration/">
            
                <a href="../../axon-server/administration/admin-configuration/">
            
                    
                    Configuration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1.1" data-path="../../axon-server/administration/admin-configuration/configuration.html">
            
                <a href="../../axon-server/administration/admin-configuration/configuration.html">
            
                    
                    System Properties
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.1.2" data-path="../../axon-server/administration/admin-configuration/command-line-interface.html">
            
                <a href="../../axon-server/administration/admin-configuration/command-line-interface.html">
            
                    
                    Command Line Interface
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.1.3" data-path="../../axon-server/administration/admin-configuration/rest-api.html">
            
                <a href="../../axon-server/administration/admin-configuration/rest-api.html">
            
                    
                    REST API
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3.2" data-path="../../axon-server/administration/monitoring/">
            
                <a href="../../axon-server/administration/monitoring/">
            
                    
                    Monitoring
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.2.1" data-path="../../axon-server/administration/monitoring/actuator-endpoints.html">
            
                <a href="../../axon-server/administration/monitoring/actuator-endpoints.html">
            
                    
                    Actuator Endpoints
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.2.2" data-path="../../axon-server/administration/monitoring/grpc-metrics.html">
            
                <a href="../../axon-server/administration/monitoring/grpc-metrics.html">
            
                    
                    gRPC Metrics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.2.3" data-path="../../axon-server/administration/monitoring/heartbeat-monitoring.html">
            
                <a href="../../axon-server/administration/monitoring/heartbeat-monitoring.html">
            
                    
                    Heartbeat Monitoring
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3.3" data-path="../../axon-server/administration/clustering.html">
            
                <a href="../../axon-server/administration/clustering.html">
            
                    
                    Clusters
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.4" data-path="../../axon-server/administration/replication-groups.html">
            
                <a href="../../axon-server/administration/replication-groups.html">
            
                    
                    Replication Groups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.5" data-path="../../axon-server/administration/multi-context.html">
            
                <a href="../../axon-server/administration/multi-context.html">
            
                    
                    Multi-Context
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.6" data-path="../../axon-server/administration/tagging.html">
            
                <a href="../../axon-server/administration/tagging.html">
            
                    
                    Tagging
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.7" data-path="../../axon-server/administration/backup-and-messaging-only-nodes.html">
            
                <a href="../../axon-server/administration/backup-and-messaging-only-nodes.html">
            
                    
                    Backup and Messaging-only Nodes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.8" data-path="../../axon-server/administration/backups.html">
            
                <a href="../../axon-server/administration/backups.html">
            
                    
                    Backups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.9" data-path="../../axon-server/administration/recovery.html">
            
                <a href="../../axon-server/administration/recovery.html">
            
                    
                    Recovery
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.10" data-path="../../axon-server/administration/plugins.html">
            
                <a href="../../axon-server/administration/plugins.html">
            
                    
                    Plugins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.11" data-path="../../axon-server/administration/error-codes.html">
            
                <a href="../../axon-server/administration/error-codes.html">
            
                    
                    Error Codes
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../../axon-server/security/">
            
                <a href="../../axon-server/security/">
            
                    
                    Security
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.1" data-path="../../axon-server/security/ssl.html">
            
                <a href="../../axon-server/security/ssl.html">
            
                    
                    SSL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.2" data-path="../../axon-server/security/access-control.html">
            
                <a href="../../axon-server/security/access-control.html">
            
                    
                    Access Control
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.3" data-path="../../axon-server/security/access-control-se.html">
            
                <a href="../../axon-server/security/access-control-se.html">
            
                    
                    Access Control - Standard Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.4" data-path="../../axon-server/security/access-control-ee.html">
            
                <a href="../../axon-server/security/access-control-ee.html">
            
                    
                    Access Control - Enterprise Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.5" data-path="../../axon-server/security/access-control-clients.html">
            
                <a href="../../axon-server/security/access-control-clients.html">
            
                    
                    Access Control - Client Applications
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.6" data-path="../../axon-server/security/access-control-cli.html">
            
                <a href="../../axon-server/security/access-control-cli.html">
            
                    
                    Access Control - CLI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.7" data-path="../../axon-server/security/access-control-api.html">
            
                <a href="../../axon-server/security/access-control-api.html">
            
                    
                    Access Control - API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.8" data-path="../../axon-server/security/access-control-ldap.html">
            
                <a href="../../axon-server/security/access-control-ldap.html">
            
                    
                    Access Control - LDAP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.9" data-path="../../axon-server/security/access-control-oauth2.html">
            
                <a href="../../axon-server/security/access-control-oauth2.html">
            
                    
                    Access Control - OAuth 2.0
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../../axon-server/performance/">
            
                <a href="../../axon-server/performance/">
            
                    
                    Performance
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.5.1" data-path="../../axon-server/performance/tuning-event-processing.html">
            
                <a href="../../axon-server/performance/tuning-event-processing.html">
            
                    
                    Event Segments
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5.2" data-path="../../axon-server/performance/flow-control.html">
            
                <a href="../../axon-server/performance/flow-control.html">
            
                    
                    Flow Control
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="../../axon-server/migration/">
            
                <a href="../../axon-server/migration/">
            
                    
                    Migration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.6.1" data-path="../../axon-server/migration/standard-to-enterprise-edition.html">
            
                <a href="../../axon-server/migration/standard-to-enterprise-edition.html">
            
                    
                    Standard to Enterprise Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6.2" data-path="../../axon-server/migration/non-axon-server-to-axon-server.html">
            
                <a href="../../axon-server/migration/non-axon-server-to-axon-server.html">
            
                    
                    Non-Axon Server to Axon Server
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Extensions</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../../extensions/spring-amqp.html">
            
                <a href="../../extensions/spring-amqp.html">
            
                    
                    Spring AMQP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../../extensions/jgroups.html">
            
                <a href="../../extensions/jgroups.html">
            
                    
                    JGroups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../../extensions/kafka.html">
            
                <a href="../../extensions/kafka.html">
            
                    
                    Kafka
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../../extensions/kotlin.html">
            
                <a href="../../extensions/kotlin.html">
            
                    
                    Kotlin
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="../../extensions/mongo.html">
            
                <a href="../../extensions/mongo.html">
            
                    
                    Mongo
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="../../extensions/reactor/reactor.html">
            
                <a href="../../extensions/reactor/reactor.html">
            
                    
                    Reactor
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.6.1" data-path="../../extensions/reactor/reactive-gateways/reactive-gateways.html">
            
                <a href="../../extensions/reactor/reactive-gateways/reactive-gateways.html">
            
                    
                    Reactor Gateways
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="../../extensions/spring-cloud.html">
            
                <a href="../../extensions/spring-cloud.html">
            
                    
                    Spring Cloud
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="../../extensions/tracing.html">
            
                <a href="../../extensions/tracing.html">
            
                    
                    Tracing
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Appendices</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../../appendices/rdbms-tuning.html">
            
                <a href="../../appendices/rdbms-tuning.html">
            
                    
                    A. RDBMS Tuning
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../../appendices/message-handler-tuning/">
            
                <a href="../../appendices/message-handler-tuning/">
            
                    
                    B. Message Handler Tuning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.2.1" data-path="../../appendices/message-handler-tuning/parameter-resolvers.html">
            
                <a href="../../appendices/message-handler-tuning/parameter-resolvers.html">
            
                    
                    Parameter Resolvers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2.2" data-path="../../appendices/message-handler-tuning/handler-enhancers.html">
            
                <a href="../../appendices/message-handler-tuning/handler-enhancers.html">
            
                    
                    Handler Enhancers
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../../appendices/meta-annotations.html">
            
                <a href="../../appendices/meta-annotations.html">
            
                    
                    C. Meta Annotations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../../appendices/identifier-generation.html">
            
                <a href="../../appendices/identifier-generation.html">
            
                    
                    D. Identifier Generation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="../../appendices/query-reference.html">
            
                <a href="../../appendices/query-reference.html">
            
                    
                    E. Axon Server Query Language
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >Event Versioning</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="event-versioning">Event Versioning</h1>
<p>In the lifecycle of an Axon application events <em>will</em> typically change their format. As events are stored indefinitely the application should be able to cope with several versions of an event. This chapter will discuss what to keep in mind when creating your events, for backwards (and forwards) compatibility. It will also explain the upcasting process.</p>
<h2 id="event-upcasting">Event Upcasting</h2>
<p>Due to the ever-changing nature of software applications it is likely that event definitions will also change over time. Since the Event Store is considered a read and append-only data source, your application must be able to read all events, regardless of when they were added. This is where upcasting comes in.</p>
<p>Originally a concept of object-oriented programming, where &quot;a subclass gets cast to its superclass automatically when needed&quot;, the concept of upcasting can also be applied to event sourcing. To upcast an event means to transform it from its original structure to its new structure. Unlike OOP upcasting, event upcasting cannot be done in full automation because the structure of the new event is unknown to the old event. Manually written upcasters have to be provided to specify how to upcast the old structure to the new structure.</p>
<p>Upcasters are classes that take one input event of revision <code>x</code> and output zero or more new events of revision <code>x + 1</code>. Moreover, upcasters are processed in a chain, meaning that the output of one upcaster is sent to the input of the next. This allows you to update events in an incremental manner, writing an upcaster for each new event revision, making them small, isolated, and easy to understand.</p>
<blockquote>
<p><strong>Note</strong></p>
<p>Perhaps the greatest benefit of upcasting is that it allows you to do non-destructive refactoring. In other words, the complete event history remains intact.</p>
</blockquote>
<p>In this section we&apos;ll explain how to write an upcaster, describe the different (abstract) implementations of the Upcaster that come with Axon, and explain how the serialized representations of events affects how upcasters are written.</p>
<p>To allow an upcaster to see what version of serialized object they are receiving, the Event Store stores a revision number as well as the fully qualified name of the Event. This revision number is generated by a <code>RevisionResolver</code>, configured in the serializer. Axon provides several implementations of the <code>RevisionResolver</code>:</p>
<ol>
<li>The <code>AnnotationRevisionResolver</code> checks for an <code>@Revision</code> annotation on the Event payload.</li>
<li>The <code>SerialVersionUIDRevisionResolver</code> uses the <code>serialVersionUID</code> as defined by Java Serialization API.</li>
<li><p>The <code>FixedValueRevisionResolver</code> always returns a predefined value. This is particularly useful when injecting the current application version.</p>
<p>It would allow you to see which version of the application generated a specific event.</p>
</li>
<li><p>Maven users can use the <code>MavenArtifactRevisionResolver</code> to automatically use the project version.</p>
<p>It is initialized using the groupId and artifactId of the project to obtain the version for.</p>
<p>Since this only works in JAR files created by Maven, the version cannot always be resolved by an IDE.</p>
<p>If a version cannot be resolved, <code>null</code> is returned.</p>
</li>
</ol>
<p>Axon&apos;s upcasters do not work with the <code>EventMessage</code> directly, but with an <code>IntermediateEventRepresentation</code>. The <code>IntermediateEventRepresentation</code> provides functionality to retrieve all necessary fields to construct an <code>EventMessage</code> (and thus a upcasted <code>EventMessage</code> too), together with the actual <em>upcast</em> functions. These upcast functions by default only allow the adjustment of the event&apos;s payload, payload type and additions to the event&apos;s metadata. The actual representation of the events in the upcast function may vary based on the event serializer used or the desired form to work with, so the upcast function of the <code>IntermediateEventRepresentation</code> allows the selection of the expected representation type. The other fields, for example the message/aggregate identifier, aggregate type, timestamp etc. are not adjustable by the <code>IntermediateEventRepresentation</code>. Adjusting those fields is not the intended work for an upcaster. As such, those options are not provided by the provided <code>IntermediateEventRepresentation</code> implementations.</p>
<p>The basic <code>Upcaster</code> interface for events in the Axon Framework works on a <code>Stream</code> of <code>IntermediateEventRepresentations</code> and returns a <code>Stream</code> of <code>IntermediateEventRepresentations</code>. The upcasting process thus does not directly return the end result of the introduced upcast functions, but chains every upcasting function from one revision to another together by stacking <code>IntermediateEventRepresentations</code>. Once this process has taken place and the end result is pulled from them, that is when the actual upcasting function is performed on the serialized event.</p>
<blockquote>
<p><strong>Conversion Notice</strong></p>
<p>Sometimes the event store can contain events in different serialized formats, since differing <code>Serializer</code> implementations where used.</p>
<p>During upcasting it is important to note what the format is of the <code>IntermediateEventRepresentation</code>, as it influences the upcaster solution provided.
To validate if the intermediate representation supports a given type, you can invoke <code>IntermediateEventRepresentation#canConvertDataTo(Class&lt;?&gt;)</code>.</p>
</blockquote>
<h3 id="provided-abstract-upcaster-implementations">Provided abstract Upcaster implementations</h3>
<p>As described earlier, the <code>Upcaster</code> interface does not upcast a single event; it requires a <code>Stream&lt;IntermediateEventRepresentation&gt;</code> and returns one. However, an upcaster is usually written to adjust a single event out of this stream. More elaborate upcasting setups are also imaginable. For example from one event to multiple, or an upcaster which pulls state from an earlier event and pushes it in a later one. This section describes the currently provided (abstract) implementations of event upcasters which a user can extend to add their own desired upcast functionality.</p>
<ul>
<li><code>SingleEventUpcaster</code> - a one-to-one implementation of an event upcaster. Extending from this implementation requires one to implement a <code>canUpcast</code> and <code>doUpcast</code> function, which respectively check whether the event at hand is to be upcasted, and if so how it should be upcasted. This is most likely the implementation to extend from, as most event adjustments are based on self contained data and are one to one.</li>
<li><code>EventMultiUpcaster</code> - a one-to-many implementation of an event upcaster. It is mostly identical to a <code>SingleEventUpcaster</code>, with the exception that the <code>doUpcast</code> function returns a <code>Stream</code> instead of a single <code>IntermediateEventRepresentation</code>. As such, this upcaster allows you to convert a single event to several events. This might be useful if you for example have figured out you want more fine grained events from a <em>fat</em> event.</li>
<li><code>ContextAwareSingleEventUpcaster</code> - a one-to-one implementation of an upcaster, which can store context of events during the process. Next to the <code>canUpcast</code> and <code>doUpcast</code>, the context aware upcaster requires one to implement a <code>buildContext</code> function, which is used to instantiate a context which is carried between events going through the upcaster. The <code>canUpcast</code> and <code>doUpcast</code> functions receive the context as a second parameter, next to the <code>IntermediateEventRepresentation</code>. The context can then be used within the upcasting process to pull fields from earlier events and populate other events. It thus allows you to move a field from one event to a completely different event.</li>
<li><code>ContextAwareEventMultiUpcaster</code> - a one-to-many implementation of an upcaster, which can store context of events during the process. This abstract implementation is a combination of the <code>EventMultiUpcaster</code> and <code>ContextAwareSingleEventUpcaster</code>, and thus services the goal of keeping context of <code>IntermediateEventRepresentations</code> and upcasting one such representation to several. This implementation is useful if you not only want to copy a field from one event to another, but have the requirement to generate several new events in the process.</li>
<li><code>EventTypeUpcaster</code> - a full upcaster implementation dedicated to changing the event type. The <code>EventTypeUpcaster</code> is an implementation of the <code>SingleEventUpcaster</code> with predefined <code>canUpcast</code> and <code>doUpcast</code> functions to be able to change an event from one event type to another. This can be used to for example change the class or package name of an event with ease. To create an <code>EventTypeUpcaster</code>, it is recommended to use the <code>EventTypeUpcaster#from(String expectedPayloadType, expectedRevision)</code> and <code>EventTypeUpcaster.Builder#to(upcastedPayloadType, upcastedRevision)</code> methods.</li>
</ul>
<h3 id="writing-an-upcaster">Writing an Upcaster</h3>
<p>The following Java snippets will serve as a basic example of a one-to-one upcaster (the <code>SingleEventUpcaster</code>).</p>
<p>Old version of the event:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Revision</span>(<span class="hljs-string">&quot;1.0&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ComplaintEvent</span> </span>{
    <span class="hljs-keyword">private</span> String id;
    <span class="hljs-keyword">private</span> String companyName;

    <span class="hljs-comment">// Constructor, getter, setter...</span>
}
</code></pre>
<p>New version of the event:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Revision</span>(<span class="hljs-string">&quot;2.0&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ComplaintEvent</span> </span>{
    <span class="hljs-keyword">private</span> String id;
    <span class="hljs-keyword">private</span> String companyName;
    <span class="hljs-keyword">private</span> String description; <span class="hljs-comment">// New field</span>

    <span class="hljs-comment">// Constructor, getter, setter...</span>
}
</code></pre>
<p>Upcaster from 1.0 revision to 2.0 revision:</p>
<p> tabs 
 tab title=&quot;Event serialized with XStream&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ComplaintEvent1_to_2Upcaster</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">SingleEventUpcaster</span> </span>{

   <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">final</span> SimpleSerializedType TARGET_TYPE =
           <span class="hljs-keyword">new</span> SimpleSerializedType(ComplaintEvent.class.getTypeName(), <span class="hljs-string">&quot;1.0&quot;</span>);

   <span class="hljs-meta">@Override</span>
   <span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">canUpcast</span><span class="hljs-params">(IntermediateEventRepresentation intermediateRepresentation)</span> </span>{
      <span class="hljs-keyword">return</span> intermediateRepresentation.getType().equals(TARGET_TYPE);
   }

   <span class="hljs-meta">@Override</span>
   <span class="hljs-function"><span class="hljs-keyword">protected</span> IntermediateEventRepresentation <span class="hljs-title">doUpcast</span><span class="hljs-params">(
           IntermediateEventRepresentation intermediateRepresentation
   )</span> </span>{
      <span class="hljs-keyword">return</span> intermediateRepresentation.upcastPayload(
              <span class="hljs-keyword">new</span> SimpleSerializedType(TARGET_TYPE.getName(), <span class="hljs-string">&quot;2.0&quot;</span>),
              org.dom4j.Document.class,
              document -&gt; {
                 document.getRootElement()
                         .addElement(<span class="hljs-string">&quot;description&quot;</span>)
                         .setText(<span class="hljs-string">&quot;no complaint description&quot;</span>); <span class="hljs-comment">// Default value</span>
                 <span class="hljs-keyword">return</span> document;
              }
      );
   }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Event serialized with Jackson&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ComplaintEvent1_to_2Upcaster</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">SingleEventUpcaster</span> </span>{
   <span class="hljs-comment">// upcaster implementation...</span>

   <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">final</span> SimpleSerializedType TARGET_TYPE =
           <span class="hljs-keyword">new</span> SimpleSerializedType(ComplaintEvent.class.getTypeName(), <span class="hljs-string">&quot;1.0&quot;</span>);

   <span class="hljs-meta">@Override</span>
   <span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">canUpcast</span><span class="hljs-params">(IntermediateEventRepresentation intermediateRepresentation)</span> </span>{
      <span class="hljs-keyword">return</span> intermediateRepresentation.getType().equals(TARGET_TYPE);
   }

   <span class="hljs-meta">@Override</span>
   <span class="hljs-function"><span class="hljs-keyword">protected</span> IntermediateEventRepresentation <span class="hljs-title">doUpcast</span><span class="hljs-params">(
           IntermediateEventRepresentation intermediateRepresentation
   )</span> </span>{
      <span class="hljs-keyword">return</span> intermediateRepresentation.upcastPayload(
              <span class="hljs-keyword">new</span> SimpleSerializedType(TARGET_TYPE.getName(), <span class="hljs-string">&quot;2.0&quot;</span>),
              com.fasterxml.jackson.databind.JsonNode.class,
              event -&gt; { 
                  ((ObjectNode) event).put(<span class="hljs-string">&quot;description&quot;</span>, <span class="hljs-string">&quot;no complaint description&quot;</span>);
                  <span class="hljs-keyword">return</span> event;
              }
      );
   }
}
</code></pre>
<p> endtab 
 endtabs </p>
<h3 id="configuring-an-upcaster">Configuring an Upcaster</h3>
<p>After choosing an upcaster type and constructing your first instance, it is time to configure it in your application.
Important in the configuration is knowing that upcasters need to be invoked in order.
Events tend to move through several format iterations, each with its own upcasting requirements.
Since an upcaster only adjusts an event from one version to another, it is paramount to maintain the ordering of the upcasters.</p>
<p>The component in charge of that ordering is the <code>EventUpcasterChain</code>.
The upcaster chain is what the <code>EventStore</code> uses to attach all the upcast functions to the event stream.</p>
<p>When configuring your upcasters, most scenarios will not require you to touch the <code>EventUpcasterChain</code> directly.
Instead, consider the following snippets when it comes to registering upcasters:</p>
<p> tabs 
 tab title=&quot;Axon Configuration API&quot; </p>
<pre><code class="lang-java"><span class="hljs-meta">@Configuration</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AxonConfig</span> </span>{
   <span class="hljs-comment">// ...</span>
   <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureUpcasters</span><span class="hljs-params">(Configurer configurer)</span> </span>{
      <span class="hljs-comment">// The method invocation order imposes the upcaster ordering</span>
      configurer.registerEventUpcaster(config -&gt; <span class="hljs-keyword">new</span> ComplaintEvent0_to_1Upcaster())
                .registerEventUpcaster(config -&gt; <span class="hljs-keyword">new</span> ComplaintEvent1_to_2Upcaster());
   }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Auto Configuration - @Order annotation&quot; 
Axon honors Spring&apos;s <code>Order</code> annotation on upcasters.
The numbers used in the annotation will dictate the ordering.
The lower the number, the earlier it is registered to the upcaster chain:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Component</span>
<span class="hljs-meta">@Order</span>(<span class="hljs-number">0</span>)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ComplaintEvent0_to_1Upcaster</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">SingleEventUpcaster</span> </span>{
   <span class="hljs-comment">// upcaster implementation...</span>

}

<span class="hljs-meta">@Component</span>
<span class="hljs-meta">@Order</span>(<span class="hljs-number">1</span>)
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ComplaintEvent1_to_2Upcaster</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">SingleEventUpcaster</span> </span>{
   <span class="hljs-comment">// upcaster implementation...</span>

}
</code></pre>
<p>The annotation can be placed both on the class itself, or on bean creation methods:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Configuration</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AxonConfig</span> </span>{
   <span class="hljs-comment">// ...</span>
   <span class="hljs-meta">@Bean</span>
   <span class="hljs-meta">@Order</span>(<span class="hljs-number">0</span>)
   <span class="hljs-function"><span class="hljs-keyword">public</span> SingleEventUpcaster <span class="hljs-title">complaintEventUpcasterOne</span><span class="hljs-params">()</span> </span>{
      <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ComplaintEvent0_to_1Upcaster();
   }

   <span class="hljs-meta">@Bean</span>
   <span class="hljs-meta">@Order</span>(<span class="hljs-number">1</span>)
   <span class="hljs-function"><span class="hljs-keyword">public</span> SingleEventUpcaster <span class="hljs-title">complaintEventUpcasterTwo</span><span class="hljs-params">()</span> </span>{
      <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> ComplaintEvent0_to_1Upcaster();
   }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Auto Configuration - EventUpcasterChain bean&quot; 
Adding an <code>EventUpcasterChain</code> bean to the Application Context will tell Axon to configure it for your event source:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Configuration</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">AxonConfig</span> </span>{
   <span class="hljs-comment">// ...</span>
   <span class="hljs-meta">@Bean</span>
   <span class="hljs-function"><span class="hljs-keyword">public</span> EventUpcasterChain <span class="hljs-title">eventUpcasterChain</span><span class="hljs-params">()</span> </span>{
      <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> EventUpcasterChain(
              <span class="hljs-keyword">new</span> ComplaintEvent0_to_1Upcaster(),
              <span class="hljs-keyword">new</span> ComplaintEvent0_to_1Upcaster()
      );
   }
}
</code></pre>
<p> endtab 
 endtabs </p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="event-bus-and-event-store.html" class="navigation navigation-prev " aria-label="Previous page: Event Bus & Event Store">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="event-serialization.html" class="navigation navigation-next " aria-label="Next page: Event Serialization">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Event Versioning","level":"3.4.5","depth":2,"next":{"title":"Event Serialization","level":"3.4.6","depth":2,"path":"axon-framework/events/event-serialization.md","ref":"axon-framework/events/event-serialization.md","articles":[]},"previous":{"title":"Event Bus & Event Store","level":"3.4.4","depth":2,"path":"axon-framework/events/event-bus-and-event-store.md","ref":"axon-framework/events/event-bus-and-event-store.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"axon-framework/events/event-versioning.md","mtime":"2021-09-13T08:33:05.990Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-09-13T08:33:36.904Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

